﻿<%@LANGUAGE="VBSCRIPT" CODEPAGE="65001"%>
<%Response.Charset="utf-8"%>
<!--#include file="const.asp" -->
<!--#include file="common/sha1.asp" -->
<!--#include file="common/funciton.asp" -->
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head><body><%
if Request.QueryString("act")="logout" then
Session.Contents.Remove(seesionname&"_login_"&request.Cookies(cookiesname&"_Login_sjcode")&"_State")
Session.Contents.Remove(seesionname&"_login_"&request.Cookies(cookiesname&"_Login_sjcode")&"_Nick")
Response.Cookies(cookiesname&"_Login_sjcode")=""
%>
	<script language="javascript">
	alert("已退出登录")
	location.href="default.asp";
	</script>
<%
else
  	dim name,password
	Uname=Request.form("UserName")
	password=request.form("Password")
	set xmldoc=server.createObject("MSXML.DOMDocument")
	xmldoc.load(strSourceFile)
	for i=0 to usernum
		UserName=userroot.childNodes.item(i).childNodes.item(0).text
		UserPassword=userroot.childNodes.item(i).childNodes.item(1).text
		if Uname=UserName and SHA256(password)=UserPassword then
			Logins="A"
			exit for
		end if
	next
	set xmldoc=nothing
	SJcode=Session(seesionname&"_login_"&request.Cookies(cookiesname&"_Login_sjcode")&"_sjcode")
	if Logins="A" and SJcode=Request.form("SJcode") then
		Session(seesionname&"_login_"&request.Cookies(cookiesname&"_Login_sjcode")&"_State")="1"
		Session(seesionname&"_login_"&request.Cookies(cookiesname&"_Login_sjcode")&"_Nick")=Uname
	%>
	<script language="javascript">
	if(confirm("登陆成功，选择确定进入后台，选择取消进入首页"))
    	{location.href="control";}
   	else
	{location.href="default.asp";} 
	</script>
	<%else%>
	<script language="javascript">
	if(confirm("登陆失败，选择确定重试，选择取消进入首页"))
    	{location.href="login.asp";}
   	else
	{location.href="default.asp";}
	</script>
	<%end if%>
<%end if%>
</body></html>